<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex assignment_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center justify-between assignment_fd0_0'      >
            <view   class='flex flex-wrap align-center assignment_fd0_0_c0'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <text class='fu-iconfont2  assignment_fd0_0_c0_c0'  >&#xE794;</text>
</view>
    <view   class='flex flex-wrap align-center'      >
        <text class='assignment_fd0_0_c1_c0'  >课程任务</text>
</view>
    <view   class='flex align-center justify-end assignment_fd0_0_c0'      >
        </view>
</view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---flex布局flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout assignment_flex_1"    >
            <template v-for = '(item,key0) in courseList'>
    <view   class='flex flex-wrap align-center self-center assignment_fd1_0'   @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/courseSections/courseSections?class_id=${item.aid}`"    :key='key0'>
        <image class='assignment_fd1_0_c0'  mode="aspectFill"  :src='item.kechengfengmian'></image>
<text class='flex-sub assignment_fd1_0_c1'  >{{item.kechengmingcheng}}</text>
    <view   class='flex flex-direction flex-wrap align-stretch'      >
        <button class='assignment_fd1_0_c2_c0'  @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/addStudy/addStudy?id=${item.aid}&shopID=${shopID}`"  >编辑</button>
<button class='assignment_fd1_0_c2_c1'  @tap.stop="postDeleteFunc(item.aid)"  >删除</button>
</view>
</view>
    </template>
    <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData" :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
</view>
        
<!---flex布局flex布局结束-->
    <view class="flex flex-wrap align-start justify-center benben-position-layout flex assignment_flex_2"    >
        <button class='assignment_fd2_0'  @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/addStudy/addStudy?shopID=${shopID}`"  >添加课程任务</button>

        </view>
<view :style="{height: '120rpx'}"  ></view>
    
    
        </view>
    </view>
</template>
<script>
    import pagingList from '@/common/mixin/paging_list.js';
import {validate} from '@/common/utils/validate.js'
    
    export default {
        components:{},
        mixins: [pagingList],
        
        data(){
			return {"minixPagingListsApi":"","pageingListApiMethod":"","allowOnloadGetList":false,"shopID":uni.getStorageSync('shopID') || '',"courseList":[]};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
            
		},
		watch:{},
		onLoad(options){
            
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
                                    this.shopID = uni.getStorageSync('shopID') || ''
this.getCourseListFunc()
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            this.getCourseListFunc()
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //获取课程列表
                 getCourseListFunc(){
                                    this.minixPagingListsApi = global.apiUrls.post6524f73c48fbe;
                this.pageingListApiMethod = 'get';
                this.allowOnloadGetList = false;
                this.pagingListPostDataContent = {shopID:this.shopID}
                this.listData = [];
                this.courseList = this.listData;
                this.pagingListToggle();
                
                },
                //提交删除课程
                async postDeleteFunc(deleteID){
                        //请求方法
    //数据验证
    
  let data652507b8d45d6 = await this.$api.dbGet(global.apiUrls.post652507b8d45d6, {
    aid:deleteID
  });
  if(!data652507b8d45d6) return
  if (data652507b8d45d6.data.code != 1) {
    this.$message.info(data652507b8d45d6.data.msg);
    return
  } 
  
  
  
                    this.$message.info('删除成功');
                setTimeout(()=>{
                            this.getCourseListFunc()
      },500)
                },
                pagingListPostData(){
                    return this.pagingListPostDataContent
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:#F8F8F8;background-size: 100% auto;
        }
    .assignment_flex_0{
        border-bottom:1px solid #eee;background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .assignment_fd0_0_c1_c0{
        font-size:36rpx;font-weight:500;color:#333333;
    }
    .assignment_fd0_0_c0_c0{
        font-size:36rpx;color:#333;font-weight:500;
    }
    .assignment_fd0_0_c0{
        width:100rpx;
    }
    .assignment_fd0_0{
        padding:0rpx 32rpx 0rpx 32rpx;line-height:88rpx;
    }
    .assignment_flex_1{
        padding:20rpx 32rpx 20rpx 32rpx;
    }
    .assignment_fd1_0_c2_c1{
        background:#E31D1A;border-radius:33rpx 33rpx 33rpx 33rpx;width:120rpx;line-height:50rpx;font-size:24rpx;color:#fff;height:50rpx;
    }
    .assignment_fd1_0_c2_c0{
        background:#E31D1A;border-radius:33rpx 33rpx 33rpx 33rpx;width:120rpx;line-height:50rpx;font-size:24rpx;color:#fff;height:50rpx;margin:0rpx 0rpx 24rpx 0rpx;
    }
    .assignment_fd1_0_c1{
        font-size:32rpx;font-weight:700;color:#333;margin:0rpx 20rpx 0rpx 20rpx;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;
    }
    .assignment_fd1_0_c0{
        width:128rpx;height:128rpx;border-radius:16rpx 16rpx 16rpx 16rpx;
    }
    .assignment_fd1_0{
        background:#fff;background-size:100% auto !important;border-radius:16rpx 16rpx 16rpx 16rpx;padding:20rpx 32rpx 20rpx 32rpx;margin:0rpx 0rpx 20rpx 0rpx;
    }
    .assignment_flex_2{
        width:750rpx;height:120rpx;overflow:hidden;z-index:10;bottom:calc(0rpx + var(--window-bottom));
    }
    .assignment_fd2_0{
        background:#E31D1A;border-radius:44rpx 44rpx 44rpx 44rpx;font-size:32rpx;color:#fff;width:686rpx;height:88rpx;line-height:88rpx;
    }
</style>